//
//  BaoSusViewController.m
//  HuiKaoClient
//
//  Created by Wang Li on 13-3-9.
//  Copyright (c) 2013年 龚 杰. All rights reserved.
//

#import "BaoSusViewController.h"
#import "MyTrainingViewController.h"
#import "AppDelegate.h"
#import "MainTabBarController.h"
#import <QuartzCore/QuartzCore.h>

@interface BaoSusViewController ()

@end

@implementation BaoSusViewController

- (id)init
{
    if (self = [super init]) {
        // Custom initialization
    }
    return self;
}

-(void) dealloc
{
    [_NavBtt release];
    [m_titleBttBarItem release];
    [super dealloc];
}

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view.
//    UILabel* tNavTitleLab = (UILabel*)[self.navigationController.navigationBar viewWithTag:144];
//    [tNavTitleLab setText:@"操作成功"];
    
    m_titleBttBarItem = [[MainTabBarController setTitle:@"操作成功"] retain];
    
    _NavBtt = [UIButton buttonWithType:UIButtonTypeCustom];
    [_NavBtt setImage:[UIImage imageNamed:@"nav_back.png"] forState:UIControlStateNormal];
    [_NavBtt addTarget:self action:@selector(navPopPressed) forControlEvents:UIControlEventTouchUpInside];
    _NavBtt.frame =CGRectMake(4, 7, 50, 30);
    [_NavBtt retain];
    UILabel* tBackLab = [[UILabel alloc] initWithFrame:CGRectMake(14, 5, 30, 20)];
    [tBackLab setBackgroundColor:[UIColor clearColor]];
    [tBackLab setTextColor:[UIColor whiteColor]];
    [tBackLab setText:@"返回"];
    [tBackLab setFont:[UIFont systemFontOfSize:13]];
    [_NavBtt addSubview:tBackLab];
    [tBackLab release];
    
    UIView* tDDView = [[UIView alloc] initWithFrame:CGRectMake(10, 12, 300, 120)];
    [tDDView setBackgroundColor:[UIColor colorWithRed:252/255.f green:243/255.f blue:226/255.f alpha:1]];
    tDDView.layer.borderWidth =1;
    tDDView.layer.borderColor = [UIColor colorWithRed:232/255.f green:194/255.f blue:133/255.f alpha:1].CGColor;
    tDDView.layer.cornerRadius = 8.f;
    [self.view addSubview:tDDView];
    [tDDView release];
    
    UILabel* tSusLab = [[UILabel alloc] initWithFrame:CGRectMake(0, 18, 300, 30)];
    [tSusLab setBackgroundColor:[UIColor clearColor]];
    [tSusLab setFont:[UIFont systemFontOfSize:20]];
    [tSusLab setText:@"报名成功"];
    tSusLab.textAlignment = UITextAlignmentCenter;
    [tSusLab setTextColor:[UIColor colorWithRed:251/255.f green:153/255.f blue:0 alpha:1]];
    [tDDView addSubview:tSusLab];
    [tSusLab release];
    
    UILabel* tDesLab = [[UILabel alloc] initWithFrame:CGRectMake(10, 52, 280, 60)];
    tDesLab.numberOfLines =3;
    [tDesLab setBackgroundColor:[UIColor clearColor]];
    [tDesLab setFont:[UIFont systemFontOfSize:12]];
    [tDesLab setText:@"报名成功，我们的客服会在1个工作日内联系你确认，您也可以通过订单中心查看培训班状态，或通过客服电话400-6666-798与我们取得联系"];
    [tDDView addSubview:tDesLab];
    [tDesLab release];
    
    UIButton* tApplyBtt = [UIButton buttonWithType:UIButtonTypeCustom];
    tApplyBtt.frame =CGRectMake(10, 146, 300, 40);
    [tApplyBtt setImage:[UIImage imageNamed:@"button_yellow_l.png"] forState:UIControlStateNormal];
    [self.view addSubview:tApplyBtt];
    [tApplyBtt addTarget:self action:@selector(orderBttPressed) forControlEvents:UIControlEventTouchUpInside];
    UILabel* tBttlab = [[UILabel alloc] initWithFrame:CGRectMake(0, 10, 300, 20)];
    [tBttlab setBackgroundColor:[UIColor clearColor]];
    [tBttlab setTextColor:[UIColor whiteColor]];
    [tBttlab setText:@"去我的培训班看看"];
    tBttlab.textAlignment =UITextAlignmentCenter;
    [tBttlab setFont:[UIFont boldSystemFontOfSize:17]];
    [tApplyBtt addSubview:tBttlab];
    [tBttlab release];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(void) viewWillAppear:(BOOL)animated
{
    [self.navigationController.navigationBar addSubview:_NavBtt];
    [self.navigationController.navigationBar addSubview:m_titleBttBarItem];
}
-(void) viewWillDisappear:(BOOL)animated
{
    [_NavBtt removeFromSuperview];
    [m_titleBttBarItem removeFromSuperview];
    
}

-(void) navPopPressed
{
    [self.navigationController popViewControllerAnimated:YES];
}

-(void) orderBttPressed
{
    MyTrainingViewController* iMyOrder = [[MyTrainingViewController alloc] init];
    //iMyOrder.hidesBottomBarWhenPushed = YES;
    iMyOrder.navigationItem.hidesBackButton =YES;
    [self.navigationController pushViewController:iMyOrder animated:YES];
    [iMyOrder release];
}

@end
